package demo;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

import com.aerospike.client.IAerospikeClient;
import com.aerospike.client.Key;
import com.aerospike.client.Value;
import com.aerospike.client.policy.WritePolicy;

public class LuaInfoTest {

    public static void main(String[] args) throws Exception {
        System.out.println(AsClientUtil.getServerInfo());

        IAerospikeClient client = AsClientUtil.getClient();
        System.out.println("client=" + client);

        String namespace = "ns1";
        String dataSetName = "testset";
        String packageName = "metric_calc";
        String functionName = "getLuaInfo";

        String keyStr = "asdemo_lua_test_key_";
        Key key = new Key(namespace, dataSetName, keyStr);

        WritePolicy policy = new WritePolicy();
        // String value = "";
        // Object result = client.execute(policy, key, packageName, functionName,
        // Value.get(value));
        // 不传参数
        Object result = client.execute(policy, key, packageName, functionName);

        System.out.println(result);
        System.out.println(result.getClass());
        
        functionName = "printTestInfo";
        result = client.execute(policy, key, packageName, functionName);

        System.out.println("functionName="+functionName+",result="+result);
        System.out.println(result.getClass());


        client.close();
    }
}
